<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var decompressRLElist = function (nums) {
      // 计算数组长度
      let len = 0;
      for (let i = 0; i < nums.length; i++) {
        len += nums[i];
        i++;
      }
      // 填充
      let result = Array(len)
      let count = 0;
      for (let i = 0; i < nums.length; i++) {
        for (let j = 0; j < nums[i]; j++) {
          result[count++] = nums[i + 1];
        }
        i++;
      }
      return result;
    };
    console.log(decompressRLElist([1, 1, 2, 3]))

  </script>
</body>

</html>